using Boo.Lang;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using UnityEngine;

[Serializable]
public class winlosedrawoneroundr : MonoBehaviour
{
	[Serializable]
	[CompilerGenerated]
	internal sealed class _0024state_0024518 : GenericGenerator<WaitForSeconds>
	{
		internal winlosedrawoneroundr _0024self__0024520;

		public _0024state_0024518(winlosedrawoneroundr self_)
		{
			_0024self__0024520 = self_;
		}

		public override IEnumerator<WaitForSeconds> GetEnumerator()
		{
			return new _0024(_0024self__0024520);
		}
	}

	[Serializable]
	[CompilerGenerated]
	internal sealed class _0024find_0024521 : GenericGenerator<WaitForSeconds>
	{
		internal winlosedrawoneroundr _0024self__0024523;

		public _0024find_0024521(winlosedrawoneroundr self_)
		{
			_0024self__0024523 = self_;
		}

		public override IEnumerator<WaitForSeconds> GetEnumerator()
		{
			return new _0024(_0024self__0024523);
		}
	}

	[Serializable]
	[CompilerGenerated]
	internal sealed class _0024Back_0024524 : GenericGenerator<WaitForSeconds>
	{
		internal winlosedrawoneroundr _0024self__0024526;

		public _0024Back_0024524(winlosedrawoneroundr self_)
		{
			_0024self__0024526 = self_;
		}

		public override IEnumerator<WaitForSeconds> GetEnumerator()
		{
			return new _0024(_0024self__0024526);
		}
	}

	public regionaltournament tc;

	public spin Player;

	public spin AI1;

	public spin AI2;

	public spin AI3;

	public GameObject win;

	public GameObject lose;

	public GameObject draw;

	public int stat;

	public threeroundsystemcr threeround;

	public bool twoplayer;

	public string curcar;

	public winlosedrawoneroundr()
	{
		curcar = "career";
	}

	public void Start()
	{
		StartCoroutine(find());
	}

	public void wld()
	{
		if (Player.speed < 10 && AI1.speed > 10)
		{
			Player.CancelInvoke("accel");
			Player.CancelInvoke("touch");
			Player.CancelInvoke("uni");
			lose.active = true;
			if ((bool)threeround)
			{
				threeround.aipoints++;
				threeround.finished();
			}
			tc.won = false;
			stat = 0;
			CancelInvoke();
		}
		if (Player.speed > 10 && AI1.speed < 10)
		{
			Player.CancelInvoke("accel");
			Player.CancelInvoke("touch");
			Player.CancelInvoke("uni");
			win.active = true;
			if ((bool)threeround)
			{
				threeround.playerpoints++;
				threeround.finished();
			}
			tc.won = true;
			stat = 0;
			CancelInvoke();
		}
		if (Player.speed == 0 && AI1.speed == 0)
		{
			Player.CancelInvoke("accel");
			Player.CancelInvoke("touch");
			Player.CancelInvoke("uni");
			win.active = true;
			if ((bool)threeround)
			{
				threeround.playerpoints++;
				threeround.finished();
			}
			tc.won = true;
			stat = 0;
			CancelInvoke();
		}
	}

	public IEnumerator state()
	{
		return new _0024state_0024518(this).GetEnumerator();
	}

	public IEnumerator find()
	{
		return new _0024find_0024521(this).GetEnumerator();
	}

	public void quit()
	{
		tc = (GameObject.Find("tournament controller2(Clone)").GetComponent("regionaltournament") as regionaltournament);
		tc.roundplaying = false;
		StartCoroutine(Back());
	}

	public IEnumerator Back()
	{
		return new _0024Back_0024524(this).GetEnumerator();
	}

	public void Main()
	{
		InvokeRepeating("wld", 7f, 0.7f);
	}
}
